$(function() {
	$('#vue_vm_list div').hide();
});

var invoiceApply = {
	invoiceApplyId: '',
	startNumber: '',
	endNumber: '',
	applyTime: '',
	applyId: '',
	applyName: '',
	quantity: '',
	approveResult: '',
	getStatus: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	createTime: '',
	updateTime: '',
};

function invoiceApply_query() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();
	var yearMonth = getStandardMonth($('#year').val(), $('#month').val());

	find_basic_by_json(path+'/invoiceApply/findByMonth', {month:yearMonth}, function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function invoiceApply_findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();
	
	findAll_basic(path+'/invoiceApply/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				invoiceApply_approve_ok:function(todo) {
					if(confirm('确实要发放吗？')) {
						todo.approveResult = 1;
						todo.getStatus = 1;
						save_basic(path+'/invoiceApply/save', {invoiceApply:todo}, function() {
							$('#'+todo.invoiceApplyId+'_div').remove();
							alert('发放成功');
						});
					}
				},
				invoiceApply_approve_deny:function(todo) {
					if(confirm('确实要拒绝吗？')) {
						todo.approveResult = 2;
						save_basic(path+'/invoiceApply/save', {invoiceApply:todo}, function() {
							$('#'+todo.invoiceApplyId+'_div').remove();
							alert('拒绝成功');
						});
					}
				}
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/invoiceApply/deleteBatch');
}
